<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <style type="text/css">
    	.bbs thead tr th{
    		text-align:center;
    	}
    	.bbs tbody tr td{
    		text-align:center;
    	}
    	.sub_item td{
    		height:20px;
    		background-color:#E8E8E8;
    	}
    </style>
    <script type="text/javascript">
    <!--
    $(function(){
    	$("#item_btn").click(function(){
    		$(".sub_item").toggle();
    		$(this).val($(this).val() == '주문상품 숨기기'? '주문상품보기' : '주문상품 숨기기'); 
    	})
    });
    //-->
    </script>
    <h2>주문조회</h2>
    <p><input type="button" class="button" id="item_btn" value="주문상품 숨기기"/> </p>
	<table border="1" cellspacing="0" width="100%" class="bbs">
	<thead>
		<tr>
			<!-- <th width="100">번호</th> -->
			<th width="150">주문번호</th>
			<th width="150">주문자</th>
			<th width="150">수령인</th>
			<th>주문일시</th>
			<th width="150">주문자</th>
			<th width="150">결제금액</th>
		</tr>
	</thead>
	<tbody>
		<!-- 반복문시작 -->
		<c:set var="pastOrderNo" value=""/>
		<c:forEach items="${list}" var="l">
		<c:url var="toView" value="order_view.action">
			<c:param name="orderNo">${l.orderNo}</c:param>
			<c:param name="currentPage">${currentPage}</c:param>
		</c:url>
		<c:if test="${pastOrderNo != l.orderNo}"><!--  -->
			<tr>
				<%-- <td>${l.orderNo}</td> --%>
				<td><a href="${toView}">제목제목제목</a></td>
				<td>${l.order_Name}</td>
				<td>${l.rec_Name}</td>
				<td>${l.buydate }</td>
				<td>${l.order_Name}</td>
				<td>${l.pay}</td>
			</tr>
			<tr class="sub_item">
				<td>${l.itemName}</td>
				<td colspan="2"><img src="/ssol2/upload/item/${l.fileName1}"  width="80"/></td>
				<td>주문수량 : ${l.amount}</td>
				<td colspan="2">${l.price}원</td>
			</tr>
		</c:if>
		<c:if test="${pastOrderNo == l.orderNo}">
			<tr class="sub_item">
				<td>${l.itemName}</td>
				<td colspan="2"><img src="/ssol2/upload/item/${l.fileName1}"  width="80"/></td>
				<td>주문수량 : ${l.amount}</td>
				<td colspan="2">${l.price}원</td>
			</tr>
		</c:if>
		<c:set var="pastOrderNo" value="${l.orderNo}"/>
		</c:forEach>
		
		<!-- 반복문끝-->
	</tbody>
	<tfoot>
		<tr>
			<td align="center" colspan="7">${pagingHtml}</td>
		</tr>
	</tfoot>
	</table>